<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            background: #2a364f;
        }
        .box{
            width: 176px;
            margin: 0 auto;
            margin-top: 30px;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-wrap: wrap;
        }
        .box button{
            width: 176px;
            padding: 22px;
            font-size: 16px;
            background: orange;
            color: white;
            border: none;
            outline: none;
            border-radius: 3px;
            margin-top: 40px;
            position: relative;
            top: 0;
            left: 0;
            z-index: 0;
            overflow: hidden;
        }
        .box button span{
            position: absolute;
            top: 0;
            left: 0;
            width: 100px;
            height: 100px;
            display: block;
            background: rgba(0, 0, 0, 0.3);
            z-index: -1;
            border-radius: 50%;
            transform: scale(0);
            pointer-events: none;/*鼠标穿透*/
            transition: transform 0.8s, background 0.5s;
        }
        button:hover span{
            transform: scale(4);
            background: rgb(062, 184, 206);
        }
        h1{
            text-align: center;
            color: #fff;
        }
    </style>
</head>
<body>
    <h1>泡泡悬停效果</h1>
    <div class="box">
        <button>
            <span></span>
            Simple button
        </button>
        <button>
            <span></span>
            Another button
        </button>
        <button>
            <span></span>
            A third button
        </button>
        <button>
            <span></span>
            A forth button
        </button>
    </div>
    <script>
       var btns = document.querySelectorAll('button');
       btns.forEach(function(btn){
           btn.onmousemove = function(event){
            console.log(event.offsetX,event.offsetY)
            this.querySelector('span').style.top = (event.offsetY - 50) + 'px';
            this.querySelector('span').style.left = (event.offsetX - 50) + 'px';
           }
       })
    </script>
</body>
</html>